#include "utils.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdio>
#include <string>
#include <io.h>
#include <cmath>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <algorithm>
#include <exception>

#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
//#include <boost/thread.hpp>

namespace bfs = boost::filesystem;
using namespace std;
using namespace bfs;



//////class Options definations//////////////////////////////////////////////////////

Options::Options()
{
	;
}

Options::~Options()
{
	;
}

int Options::registration_options(const string& option_key_)
{
	if (option_key_.empty()){
		std::cout << "warning : unsuitable value for option registration \r\n";
		return -1;
	}
	if (! CheckKey(option_key_)){
		options_[option_key_] = "";
	}else{
		return 0;
	}
}


int Options::add_options(const string& option_key_, const string& option_value_)
{
	if (option_key_.empty() || option_value_.empty()){
		std::cout << "warning : unsuitable value for option adding \r\n";
		return -1;
	}
	if (CheckKey(option_key_)){
		options_[option_key_] = option_value_;
	}else{
		std::cout << "warning : wrong option key for options \r\n";
		return -1;
	}
	return 0;
}

bool Options::CheckKey(const string& option_key_) const
{
	std::map<string, string>::const_iterator option_it = options_.find(option_key_);
	if (option_it != options_.end()){
		return true;
	}
	return false;
}



string Options::get_option_value(const string& option_key_)
{
	string key_ = ""; key_.assign(option_key_.data());
	if (key_.empty()){
		return "";
	}
	if (CheckKey(key_)){
		string value_; value_.assign(options_[key_]);
		return value_;
	}else
		return "";
}


int Options::registration_value(const string& option_value)
{
	return 0;
}
